package com.etao.restaurantservice.service.impl;

/**
 * 2012-7-8
 * jqsl2012@163.com
 */

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etao.restaurantdao.dao.impl.SupplierDishDaoImpl;
import com.etao.restaurantdao.dao.inter.ISupplierDishDao;
import com.etao.restaurantentity.enums.SupplierServiceType;
import com.etao.restaurantentity.resp.SupplierQuery;
import com.etao.restaurantentity.servicedomain.SupplierDish;
import com.etao.restaurantentity.servicedomain.SupplierServiceInfo;
import com.etao.restaurantservice.common.ServersManager;
import com.etao.restaurantservice.service.inter.ISupplierDishService;

import javax.annotation.Resource;

/**
 * @author huangf
 */
@Service
public class SupplierDishServiceImpl extends ServersManager<SupplierDish, ISupplierDishDao>
		implements ISupplierDishService {

	/* @Resource(name="supplierDishDaoImpl") */
	/*
	 * @Override public void setDao(ISupplierDishDao supplierDishDao) { this.dao
	 * = supplierDishDao; }
	 */

	@Override
	public List<SupplierDish> selectSupplierDishMenu(SupplierDish e) {
		return dao.selectSupplierDishMenu(e);
	}

	@Override
	public List<SupplierQuery> GetSupplierQuery(Map<String, String> map) {
		return dao.GetSupplierQuery(map);
	}

	@Override
	public Integer GetFeatureCount(Integer supplierId) {
		return dao.GetFeatureCount(supplierId);
	}

	@Override
	public SupplierServiceInfo FindBySupplierId(Map<String, Integer> map) {
		SupplierServiceInfo serviceInfo = dao.FindBySupplierId(map);
		if (serviceInfo == null) {
			serviceInfo = new SupplierServiceInfo();
			serviceInfo.setCount(0);
			serviceInfo.setRechargeTimes(0);
			serviceInfo.setSupplierId(map.get("SupplierId"));
			serviceInfo.setType(map.get("Type"));
			this.Insert(serviceInfo);
		}
		return serviceInfo;
	}

	@Override
	public int Insert(SupplierServiceInfo info) {
		return dao.Insert(info);
	}

}
